package Structural_design_pattern.Decorator_Pattern.Example2;


//具体装饰类
public class ComplexCipher extends CipherDecorator {
    public ComplexCipher(Cipher cipher) {
        super(cipher);
    }

    public String Encrypt(String plainText) {
        String result = super.Encrypt(plainText);
        result = reverse(result);
        return result;
    }

    public String reverse(String text) {
        String str = "";
        for(int i=text.length(); i>0; i--) {
            str+=text.substring(i-1,i);
        }
        return str;
    }
}
